/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package views;

import healthcare.coursework.model.Patient;
import healthcare.coursework.service.PatientService;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericAutowireComposer;
import org.zkoss.zul.Label;
import org.zkoss.zul.Window;

/**
 *
 * @author Administrator
 */
public class ViewPatient extends GenericAutowireComposer {

    private Label fullName;
    private Label birthdate;
    private Label address;
    private Label phone;
    private Label job;
    private Patient patient;
    private Label trackcode;
    private Window self;
    private PatientService patientService = util.Utility.getUtility().getPatientService();

    @Override
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);
        System.out.println("View Patient window");
        setInformation();
    }

    public ViewPatient() {
        
    }

  
    public void onClose(Event e) {
        self.onClose();
    }

    public void setInformation() {
        patient = (Patient) arg.get("patient");
        System.out.println("Enter Info: "+patient.getPatientId());
        trackcode.setValue(patient.getTrackCode());
        fullName.setValue(patient.getFullName());
        birthdate.setValue(patient.getDateOfBirth().toString());
        job.setValue(patient.getJob());
        address.setValue(patient.getAddress());
        phone.setValue(patient.getPhone());
    }
}
